package org.nvm.dic;

public class Hit {
	/*
	 * match和prefix_match可以共存
	 */
	//Hit不匹配
	private static final int UNMATCH = 0x00000000;
	//Hit完全匹配
	private static final int MATCH = 0x00000001;
	//Hit前缀匹配
	private static final int PREFIX_MATCH = 0x00000010;
	
	private int hitState = UNMATCH;
	
	private DictSegment matchedDictSegment;
	
	private int begin;
	private int end;
	
	public void setMatch() {
		hitState = hitState | MATCH;
	}
	public boolean isMatch() {
		return (this.hitState & MATCH) > 0;
	}
	public void setPrefixMatch() {
		hitState = hitState | PREFIX_MATCH;
	}
	public boolean isPrefixMatch() {
		return (this.hitState & PREFIX_MATCH) > 0;
	}
	public void setUnMatch() {
		hitState = UNMATCH;
	}
	public boolean isUnMatch() {
		return this.hitState == UNMATCH;
	}
	
	public DictSegment getMatchedDictSegment() {
		return matchedDictSegment;
	}
	public void setMatchedDictSegment(DictSegment matchedDictSegment) {
		this.matchedDictSegment = matchedDictSegment;
	}
	public int getBegin() {
		return begin;
	}
	public void setBegin(int begin) {
		this.begin = begin;
	}
	public int getEnd() {
		return end;
	}
	public void setEnd(int end) {
		this.end = end;
	}
}
